package 腾讯;

import java.util.Arrays;
import java.util.Scanner;

public class Main1 {
    public static void main(String[] args) {
        Scanner cin=new Scanner(System.in);
        int n=cin.nextInt();
        cin.nextLine();
        String[] lines=new String[n];
        for (int i = 0; i < n; i++) {
            lines[i]=cin.nextLine();
        }
        int len=lines[0].length();
        long[] nums=new long[len];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < len; j++) {
                nums[j] = (nums[j] * 10) + Integer.parseInt(String.valueOf(lines[i].charAt(j)));
            }
        }
        Arrays.sort(nums);
        for (int i = 0; i < len; i++) {
            System.out.print(nums[i]+" ");
        }
    }
}
